﻿<?php
if(!defined('IN_PHPSCUP'))exit('hacking'); 
class SxdModel extends BaseModel
{

    var $table  = 'sx_data';	

    var $_page_rows = 20;	
	
    /* 插入数据 */
    function post($data)
    {    
	
		$time = time();      
		return $this->IU_Sql_Exe(array ('data' => array('parent_id'=>"$data[parent_id]",'name'=>"$data[name]",'sort'=>"$data[sort]"), 'mode' => 'INSERT'));

        
    }

    function show($id=0)
    {   
	
		 $info = $this->S_Sql_Exe(array('fields' =>'*','conditions' =>"sort = '{$id}' "));
    
		 return $info;
        
    }

    /* 删除数据 */
    function del($id ='')
    {      
		return $this->D_Sql_Exe(array ('conditions' =>"id = '{$id}' "));
        
    }

    /* 修改数据 */
    function editaction($id ='',$data = '')
    {    
		$time = time();  	      
		return $this->IU_Sql_Exe(array ('data' => array('name'=>"$data[name]"),'mode' => 'UPDATE','conditions' =>"id = '{$id}' "));
        
    }



    /* 通过id取出一条数据 */
    function oneshow($id ='')
    {    
	      
		 $info = $this->S_Sql_Exe(array('fields' =>'*','conditions' =>"id='{$id}'",'return' =>'one'));
    
		 return $info;
        
    }


}




?>